$(function(){
	//上传图片
	new AjaxUpload('#addLabProdPic', {
		action: 'upload', 
		name: 'picFile',
		responseType: 'json',
		onSubmit : function(file , ext){
			if (ext && /^(jpg|png|bmp)$/.test(ext.toLowerCase())){
				this.setData({
					'picName': file
				});
			} else {
				alert("请上传格式为 jpg|png|bmp 的图片！");
				return false;				
			}
		},
		onComplete : function(file,response){
			if(response.error) {
				alert(response.error);
				return;
			}
			$('#viewImg').attr('src',response.picUrl);
			$("#picpath").val(response.picUrl);
		}		
	});
});
